package com.daedalus.Inheritanca.PersonTaksa;

/**
 * Created with IntelliJ IDEA.
 * User: kostika
 * Date: 12/19/12
 * Time: 11:03 AM
 * To change this template use File | Settings | File Templates.
 */
public class Pensionist extends Person {
    private int vitiDaljes;

    public Pensionist(String emer, String mbiemer, int mosha, String vendLindja, char gjinia, double teArdhurat, int vitiDaljes) {
        super(emer, mbiemer, mosha, vendLindja, gjinia, teArdhurat);
        this.setVitiDaljes(vitiDaljes);
    }

    public int getVitiDaljes() {
        return vitiDaljes;
    }

    public void setVitiDaljes(int vitiDaljes) {
        this.vitiDaljes = vitiDaljes;
    }


    public boolean canBePensionist(){
        if ( (getGjinia()=='M' && getMosha() >= 65) ||  (getGjinia()=='F' && getMosha() >= 60)) {
            return true;
        }
        return false;
    }

    @Override
    public double llogaritTaksat(){
        if (getTeArdhurat()<=20000.0){
            return 0.02*getTeArdhurat();
        } else {
            return 0.1*getTeArdhurat();
        }
    }

    public String toString(){
        return String.format("Emri: %s\nMbiemri: %s\nTe Ardhurat: %.2f\nTaksat: %.2f\n" +
                "Mosha: %d\nVendlindja: %s\nGjinia: %c\nViti Pension: %d\nI takon: %s\n",
                getEmer(),getMbiemer(),getTeArdhurat(),llogaritTaksat(),getMosha(),getVendLindja(),getGjinia(),getVitiDaljes(),(canBePensionist()==true?"PO":"JO"));
    }
}
